<template>
	<el-menu @select="menuSelect" @open="menuOpen" @close="menuClose">
		<MenuItem :menu-list="menuList"></MenuItem>
	</el-menu>
</template>

<script>
import MenuItem from './MenuItem.vue'
export default{
	name: 'Menu',
	components: {
		MenuItem
	},
	props: {
		menuList: {
			type: Array,
			default: () => []
		},
		link: {
			type: Function,
			default: function(index){}
		}
	},
	methods: {
		menuSelect: function(index){
			this.link(index)
		},
		menuOpen: function(index){
			this.link(index)
		},
		menuClose: function(index){
			this.link(0)
		}
	}
}
</script>

<style>
</style>